﻿namespace CN2P.Web.Controllers.Api.Proxy
{
    using System.Collections.Generic;
    using System.Net;
    using System.Net.Http;
    using System.Web.Http;
    using CN2P.ServiceModel;

    public class SessionApiProxyController : BaseApiProxyController
    {
        [AcceptVerbs("GET")]
        public IList<string> Get(string userId, int count = int.MaxValue)
        {
            var decodedUserId = this.DecodeUserId(userId);
            return client.SessionService.Get(decodedUserId, count);
        }

        [AcceptVerbs("POST")]
        public HttpResponseMessage Post([FromBody]SessionItemModel item)
        {

            client.SessionService.Post(item.UserId, item);

            return Request.CreateResponse(HttpStatusCode.Created);
        }
    }
}